s_hsSkyBrightness

Creating scenes and optical images as we change the skymap brightness, from day to night.
I used this to create a GIF for presentations, showing how the reduction in the sky brightness changes the overall sensor illuminance.
The scenes have with different amounts of sky light, but otherwise the same.
The irradiance axis levels (scale on the right) are set by a function at the end.
(Once the files are all written out, I used Powerpoint to make them into a gif)
See also

Get the scenes

ieInit;
imageID = '1112201236'; % - Good one
lgt = {'headlights','streetlights','otherlights','skymap'};
destPath = fullfile(isethdrsensorRootPath,'data',imageID);
 
scenes = cell(numel(lgt,1));
for ll = 1:numel(lgt)
thisFile = sprintf('%s_%s.exr',imageID,lgt{ll});
destFile = fullfile(destPath,thisFile);
if ~exist(destFile,"file")
ieWebGet('deposit name','isethdrsensor-paper',...
'deposit file',fullfile('data',imageID,thisFile),...
'download dir',fullfile(isethdrsensorRootPath,'data',imageID),...
'unzip',false);
end
scenes{ll} = piEXR2ISET(destFile);
end
*** Downloading data/1112201236/1112201236_headlights.exr from ISETHDRSensor on SDR ... *** File is downloaded! *** Downloading data/1112201236/1112201236_streetlights.exr from ISETHDRSensor on SDR ... *** File is downloaded! *** Downloading data/1112201236/1112201236_otherlights.exr from ISETHDRSensor on SDR ... *** File is downloaded! *** Downloading data/1112201236/1112201236_skymap.exr from ISETHDRSensor on SDR ... *** File is downloaded!

Create the optics with some flare

[oi,wvf] = oiCreate('wvf');
params = wvfApertureP;
 
% We should implement wvfApertureSet/Get so we do not have to remember
% the parameter names precisely.
params.nsides = 3;
params.dotmean = 50;
params.dotsd = 20;
params.dotopacity =0.5;
params.dotradius = 5;
params.linemean = 50;
params.linesd = 20;
params.lineopacity = 0.5;
params.linewidth = 2;
 
aperture = wvfAperture(wvf,params);

Loop through the scene skymap levels

% headlights, street lights, other lights, sky map
% wgts = [0.0124 0.0011 0.0010 2.396];
 
wgts = [0.0124 5*0.0011 3*0.0010 100*2.396];
sf = 0.25;
cnt = 1;
for ii=1:7
fprintf('Scene %d, wgts(4) %f\n',ii, wgts(4));
 
combinedScene = sceneAdd(scenes, wgts);
combinedScene = piAIdenoise(combinedScene);
 
% Denoising takes some time.
% scene = hsSceneCreate(imageID,'weights',wgts,'denoise',true);
 
% [scene,wgts] = hsSceneCreate(imageID,'dynamic range',10^5,'low light',10,'denoise',true);
oi = oiCompute(oi, combinedScene,'aperture',aperture,'crop',true, 'pixel size',3e-6);
% For visibility
oiWindow(oi);
if ii < 4, oi = oiSet(oi,'gamma',0.7);
else, oi = oiSet(oi,'gamma',0.3);
end
 
oiPlot(oi,'illuminance hline rgb',[1 564]);
drawnow;
 
setAxisAndWrite(cnt);
cnt = cnt + 1;
wgts(4) = wgts(4)*sf;
end
Scene 1, wgts(4) 239.600000
Denoised in: 16.473
Scene 2, wgts(4) 59.900000
Denoised in: 17.236
Scene 3, wgts(4) 14.975000
Denoised in: 16.801
Scene 4, wgts(4) 3.743750
Denoised in: 17.355
Scene 5, wgts(4) 0.935937
Denoised in: 17.563
Scene 6, wgts(4) 0.233984
Denoised in: 17.289
Scene 7, wgts(4) 0.058496
Denoised in: 17.127

-----------------------------------------

function setAxisAndWrite(cnt)
% Set up the axis
 
ax = gca; yyaxis right
ax.YAxis(2).Limits = [10^-4,10^4];
n = 7; yTick = logspace(-3,3,n);
yTick = yTick(1:2:n); % Space by 2 log units
set(ax,'ytick',yTick);
 
fname = sprintf('test-%d.png',cnt);
fname = fullfile(isethdrsensorRootPath,'local',fname);
exportgraphics(ax,fname);
 
end